package net.chrisrichardson.ec2deployer.cluster

class ListSplitter {

    private List list

    ListSplitter(List originalList) {
        this.list = new ArrayList(originalList)
    }

    def next(int n) {
        def result = list[0..<n]
        list = list[n..<list.size()]
        result
    }

    def nextOne() {
        next(1)[0]
    }

}